import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
// 步骤一：异步下载 访问接口，获取excel表格下载路径
function downloadOne(key) {
  return fetch({
      url: `${baseUrl}/minorScoreExport/result/${key}`,
      method: 'get'
  });
}
// 以步骤一返回的path路径，下载excel表格
// status为true时，上一个接口回将生成的excel文件的地址返回。然后访问下面的接口。去导出excel
function downloadTwo(params) {
  return fetch({
      url: `${baseUrl}/minorScoreExport/file?file=` + params.path + '&name=' + params.name,
      method: 'get'
  });
}
// 查询辅修成绩记录方式列表
function getScoreRecordMethodList(data) {
  return fetch({
      url: baseUrl + "/minorGradeSettingController/queryMinorGradeRecordSetInfos",
      method: 'post',
      data
  });
}
// 新增辅修成绩记录方式
function addScoreRecordMethod(data) {
  return fetch({
      url: baseUrl + "/minorGradeSettingController/addMinorGradeRecordSetInfo",
      method: 'post',
      data
  });
}
// 查询辅修成绩记录方式单个
function getScoreRecordMethod(data) {
  return fetch({
      url: baseUrl + "/minorGradeSettingController/queryMinorGradeRecordSetInfoSingle",
      method: 'post',
      data
  });
}
// 修改辅修成绩记录方式
function editScoreRecordMethod(data) {
  return fetch({
      url: baseUrl + "/minorGradeSettingController/updateMinorGradeRecordSetInfo",
      method: 'post',
      data
  });
}
// 删除辅修成绩记录方式
function deleteScoreRecordMethod(data) {
  return fetch({
      url: baseUrl + "/minorGradeSettingController/deleteMinorGradeRecordSetInfo",
      method: 'post',
      data
  });
}
// 查询辅修成绩全局设置信息
function queryGlobalSetInfo(data) {
  return fetch({
      url: baseUrl + "/minorGradeGlobalSetController/queryMinorGradeGlobalSetInfos",
      method: 'post',
      data
  });
}
// 新增/更新辅修成绩全局设置信息
function addOrUpdateGlobalSetInfo(data) {
  return fetch({
      url: baseUrl + "/minorGradeGlobalSetController/addOrUpdateMinorGradeGlobalSetInfos",
      method: 'post',
      data
  });
}
// 成绩权限开关列表数据
function getGradeRightSwitchList(data) {
  return fetch({
      url: baseUrl + "/scoreEntrySettingController/scoreEntrySettingList",
      method: 'post',
      data
  });
}
// 查询开课学院
function queryStartCollege(data) {
  return fetch({
      url: baseUrl + "/scoreEntrySettingController/findOpenCollege",
      method: 'post',
      data
  });
}
// 更新成绩录入开关设置
function updateScoreEntrySwitch(data) {
  return fetch({
      url: baseUrl + "/scoreEntrySettingController/updateScoreEntrySetting",
      method: 'post',
      data
  });
}
// 批量删除成绩录入开关设置
function deleteScoreEntrySwitch(ids) {
  return fetch({
      url: baseUrl + "/scoreEntrySettingController/batchDelScoreEntrySetting?ids=" + ids,
      method: 'delete'
  });
}
// 新增/保存成绩录入开关设置
function addOrSaveScoreEntrySwitch(data) {
  return fetch({
      url: baseUrl + "/scoreEntrySettingController/saveScoreEntrySetting",
      method: 'post',
      data
  });
}
// 获取总评成绩记录方式
function getTotalEvalScoreRecordType(data) {
  return fetch({
      url: baseUrl + "/scoreEntrySettingController/queryScoreInputType",
      method: 'post',
      data
  });
}
// 辅修课程成绩管理查询
function queryCourseScoreMana(data) {
  return fetch({
      url: baseUrl + "/minorCourseGradeManageController/queryCourseGradeManage",
      method: 'post',
      data
  });
}
// 指定录入人
function pointDesignatedEntry(data) {
  return fetch({
      url: baseUrl + "/minorCourseGradeManageController/addMinorImporterInfo",
      method: 'post',
      data
  });
}
// 取消录入人
function cancelDesignatedEntry(data) {
  return fetch({
      url: baseUrl + "/minorCourseGradeManageController/cancelMinorImporterInfo",
      method: 'post',
      data
  });
}
// 辅修课程成绩管理白名单查询
function queryCourseScoreManaWhiteInfo(data) {
  return fetch({
      url: baseUrl + "/minorGradeManageWhiteInfoController/queryCourseGradeManageWhiteInfos",
      method: 'post',
      data
  });
}
// 新增辅修课程成绩管理白名单
function addCourseScoreManaWhiteInfo(data) {
  return fetch({
      url: baseUrl + "/minorGradeManageWhiteInfoController/addCourseGradeManageWhiteInfo",
      method: 'post',
      data
  });
}
// 删除辅修课程成绩管理白名单
function deleteCourseScoreManaWhiteInfo(data) {
  return fetch({
      url: baseUrl + "/minorGradeManageWhiteInfoController/deleteCourseGradeManageWhiteInfo",
      method: 'post',
      data
  });
}
// 根据课程编码查询辅修课程信息
function queryCourseInfoByCourseCode(data) {
  return fetch({
      url: baseUrl + "/minorGradeManageWhiteInfoController/queryCourseInfoByCode",
      method: 'post',
      data
  });
}
// 期末总评成绩分页接口
function queryFinalAssessResults(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/queryScoreEnterInfoList",
      method: 'post',
      data
  });
}
// 发送短信
function sendMessage(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/sendSms",
      method: 'post',
      data
  });
}
// 验证短信
function validateMessage(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/validationSms",
      method: 'post',
      data
  });
}
// 期末总评成绩空白登分表
function queryBlankScoreSheet(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/getMinorScoreEntryBlankBasicInfo",
      method: 'post',
      data
  });
}
// 期末总评成绩查看成绩列表
function selectGradeListFinalTotal(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/viewStudentScoreBasicInfo",
      method: 'post',
      data
  });
}
// 期末总评成绩查看成绩统计信息
function selectGradeStatistics(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/viewStudentScoreStatInfo",
      method: 'post',
      data
  });
}
// 期末总评成绩-成绩构成
function queryScoreStucture(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/getFinalScoreStructureInitPage",
      method: 'post',
      data
  });
}
// 获取成绩开关录入时间
function queryScoreEntryTime(params) {
  return fetch({
      url: `${baseUrl}/minorScoreEntryController/queryMinorScoreEnterTime?calendarId=` + params.calendarId + '&examType=' + params.examType,
      method: 'get'
  });
}
// 成绩构成保存
function saveScoreStructureInfo(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/saveMinorScoreStructureInfo",
      method: 'post',
      data
  });
}
// 辅修重缓考成绩管理查询
function queryRetakeGradeManage(data) {
  return fetch({
      url: baseUrl + "/minorRetakeGradeManageController/queryRetakeGradeManage",
      method: 'post',
      data
  });
}
// 查询成绩录入详情
function getFinalScoreEntryInitPage(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/getFinalScoreEntryInitPage",
      method: 'post',
      data
  });
}
// 成绩录入保存/提交
function saveAndSubmitGradeEntry(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/saveMinorFinalEnterStudentScore",
      method: 'post',
      data
  });
}
// 成绩录入-校验接口
function validateGradeEntry(params) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/validMinorScoreEntryCondition?calendarId=" + params.calendarId + '&examType=' + params.examType + '&faculty=' + params.faculty + '&teachingClassId=' + params.teachingClassId + '&courseCode=' + params.courseCode,
      method: 'get'
  });
}
// 成绩录入-模板下载
function downloadGradeEntryTemplate(params) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/downloadMinorFinalStudentScoreTemplate?calendarId=" + params.calendarId + '&examType=' + params.examType + '&teachingClassId=' + params.teachingClassId + '&courseCode=' + params.courseCode,
      method: 'get'
  });
}
// 根据课程编码查询辅修部分发布课程
function queryWhiteCourseInfoByCode(data) {
  return fetch({
      url: baseUrl + "/minorGradeManageWhiteInfoController/queryWhiteCourseInfoByCode",
      method: 'post',
      data
  });
}
// 辅修课程成绩管理查询（空白登分表、查看成绩列表、总评成绩表、总评成绩表-分项）
function getMinorGradeInfos(data) {
  return fetch({
      url: baseUrl + "/minorCourseGradeManageController/getMinorGradeInfos",
      method: 'post',
      data
  });
}
// 获取辅修成绩统计分布
function getMinorGradeCountDistribute(data) {
  return fetch({
      url: baseUrl + "/minorCourseGradeManageController/getMinorGradeCountDistribute",
      method: 'post',
      data
  });
}
// 学生成绩维护查询
function getStudentGradeMaintain(data) {
  return fetch({
      url: baseUrl + "/minorStudentScoreManager/studentScore/getListPage",
      method: 'post',
      data
  });
}
// 学号-学生基本信息
function queryStudentInfoByCode(params) {
  return fetch({
      url: `${baseUrl}/minorStudentScoreManager/studentScore/queryStudentInfoByCode?studentCode=` + params.studentCode + `&projectId=` + params.projectId,
      method: 'get'
  });
}
// 查看-课程成绩信息
function queryCourseScoreInfoById(params) {
  return fetch({
      url: `${baseUrl}/minorStudentScoreManager/studentScore/queryCourseScoreInfoById?id=` + params.id,
      method: 'get'
  });
}
// 修改学生成绩维护
function updateStudentGradeMaintain(data) {
  return fetch({
      url: baseUrl + "/minorStudentScoreManager/studentScore/update",
      method: 'post',
      data
  });
}
// 删除学生成绩维护
function deleteStudentGradeMaintain(data) {
  return fetch({
      url: baseUrl + "/minorStudentScoreManager/studentScore/deleteById",
      method: 'post',
      data
  });
}
// 导出学生成绩维护信息
function downloadStudentGradeMaintain(data) {
  return fetch({
      url: baseUrl + "/minorStudentScoreManager/studentScore/download",
      method: 'post',
      data
  });
}
// 辅修成绩变更列表查询
function getGradeChangeList(data) {
  return fetch({
      url: baseUrl + "/minorScoreChange/getMinorScoreList",
      method: 'post',
      data
  });
}
// 辅修成绩变更-提交变更申请
function applyOrEditScoreChangeApply(data) {
  return fetch({
      url: baseUrl + "/minorScoreChange/minorScoreChangeApply",
      method: 'post',
      data
  });
}
// 辅修成绩变更-学生基本信息
function queryScoreChangeStudentInfo(params) {
  return fetch({
      url: `${baseUrl}/minorScoreChange/queryStudentBasicInfoById?studentId=` + params.studentId + '&calendarId=' + params.calendarId,
      method: 'get'
  });
}
// 辅修成绩变更-学生辅修成绩
function queryScoreChangeGradeInfo(params) {
  return fetch({
      url: `${baseUrl}/minorScoreChange/queryMinorScoreInfoById?studentId=` + params.studentId + '&calendarId=' + params.calendarId,
      method: 'get'
  });
}
// 辅修成绩变更-查看变更申请
function selectScoreChangeApplyInfo(params) {
  let url = `${baseUrl}/minorScoreChange/queryMinorScoreChangeApplyInfoById?studentId=` + params.studentId + '&calendarId=' + params.calendarId + '&id=' + params.id
  if (params.auditStatus) {
    url += '&auditStatus=' + params.auditStatus
  }
  return fetch({
      url: url,
      method: 'get'
  });
}
// 成绩变更审核列表
function getScoreChangeAuditList(data) {
  return fetch({
      url: baseUrl + "/gradeChangeApproval/getApproveList",
      method: 'post',
      data
  });
}
// 获取指定审核人下拉框
function getScoreChangePointAudit(data) {
  return fetch({
      url: baseUrl + "/gradeChangeApproval/getReviewerList",
      method: 'post',
      data
  });
}
// 指定审核人
function pointAuditPerson(data) {
  return fetch({
      url: baseUrl + "/gradeChangeApproval/updateReviewer",
      method: 'post',
      data
  });
}
// 审核成绩变更
function auditGradeChange(data) {
  return fetch({
      url: baseUrl + "/gradeChangeApproval/approval",
      method: 'post',
      data
  });
}
// 导出其他境外交流项目列表--导出
function exportProjectManageList(path) {
  return fetch({
      url: `${baseUrl}/pgOverseasExchangeProject/downloadFile?path=` + path,
      method: 'get'
  });
}
// 成绩操作日志--日志查询
function getScroeOperationLog(data) {
  return fetch({
      url: baseUrl + "/minorScoreOperationLog/listMinorScoreOperationLogPage",
      method: 'post',
      data
  });
}
// 成绩操作日志--获取操作类型
function getMinorScoreOptionTypeList(params) {
  return fetch({
      url: baseUrl + "/minorScoreOperationLog/getMinorScoreOptionTypeList",
      method: 'get'
  });
}
// 成绩操作日志--导出成绩操作日志
function exportMinorScoreOperationLog(data) {
  return fetch({
      url: baseUrl + "/minorScoreOperationLog/exportMinorScoreOperationLog",
      method: 'post',
      data,
      responseType: 'blob'
  }).then(res => {
      UTILS.downloadFile(res, '成绩操作日志.xls', 'application/vnd.ms-excel;charset=utf-8');
  });
}
// 成绩查询-我都成绩
function getListPage(params) {
  return fetch({
      url: `${baseUrl}/minorStudentScoreManager/studentScoreSearch/getListPage?studentId=`+ params.studentId + '&advancedLevelCode=' + params.advancedLevelCode,
      method: 'get'
  });
}
// 学生成绩打印查询
function getScoreListPage(data) {
  return fetch({
      url: baseUrl + "/minorStudentScoreManager/studentScorePrint/getListPage",
      method: 'post',
      data
  });
}
// 学生成绩打印查询--预览
function getScorePreview(params) {
  return fetch({
      url: `${baseUrl}/minorStudentScoreManager/studentScorePrint/preview?studentId=`+ params.studentId + '&language=' + params.language + '&minorFaculty=' + params.minorFaculty + '&minorProfession=' + params.minorProfession + '&advancedLevel=' + params.advancedLevel,
      method: 'get'
  });
}
// 学生成绩打印查询--导出学生成绩
function exportMinorStudentScorePrint(params) {
    let url = `${baseUrl}/minorStudentScoreManager/studentScorePrint/export/zip?studentId=`+ params.studentId + '&language=' + params.language + '&minorFaculty=' + params.minorFaculty + '&minorProfession=' + params.minorProfession + '&advancedLevel=' + params.advancedLevel
    window.open(url)
}
// 辅修课程成绩变更申请-查询
function queryCourseScoreChangeApply(data) {
  return fetch({
      url: baseUrl + "/minorStudentScoreManager/courseScoreChangeApply/getListPage",
      method: 'post',
      data
  });
}
// 辅修课程成绩变更申请-提交变更申请
function applyOrEditScoreChangeSubmit(data) {
  return fetch({
      url: baseUrl + "/minorStudentScoreManager/submit",
      method: 'post',
      data
  });
}
// 查看-课程成绩信息
function getApproveDetail(params) {
  return fetch({
      url: `${baseUrl}/courseChangeApproval/getApproveDetail?id=` + params.id,
      method: 'get'
  });
}
// 辅修课程成绩变更审核-查询
function queryApproveList(data) {
  return fetch({
      url: baseUrl + "/courseChangeApproval/getApproveList",
      method: 'post',
      data
  });
}
// 辅修课程成绩变更审核-指定审核人
function updateReviewer(data) {
  return fetch({
      url: baseUrl + "/courseChangeApproval/updateReviewer",
      method: 'post',
      data
  });
}
// 辅修课程成绩变更审核-审核
function confirmationAudit(data) {
  return fetch({
      url: baseUrl + "/courseChangeApproval/approval",
      method: 'post',
      data
  });
}
// 辅修成绩录入清空成绩
function clearScoreEntries(data) {
  return fetch({
      url: baseUrl + "/minorScoreEntryController/clearScoreEntries",
      method: 'post',
      data
  });
}
// 辅修成绩申请变更点击提交按钮弹出提示
function minorScoreChangeTip(data) {
  return fetch({
      url: baseUrl + "/minorScoreChange/minorScoreChangeTip",
      method: 'post',
      data
  });
}

// 辅修学生成绩查询
function queryStudentBasicInfo(studentId) {
  return fetch({
    url: `${baseUrl}/minorStudentScoreManager/studentScoreSearch/queryStudentBasicInfo?studentId=`+studentId,
    method: 'get'
  })
}
// 辅修课程成绩管理取消发布
function cancelMinorPublish(data) {
  return fetch({
      url: baseUrl + "/minorCourseGradeManageController/cancelMinorPublish",
      method: 'post',
      data
  });
}
// 辅修课程成绩管理校验是否存在审批中的成绩变更申请
function checkHasGradeChange(data) {
  return fetch({
      url: baseUrl + "/minorCourseGradeManageController/checkHasGradeChange",
      method: 'post',
      data
  });
}
// 辅修学生成绩打印批量导出
function exportBatch(data,params) {
  return fetch({
    url: `${baseUrl}/minorStudentScoreManager/studentScorePrint/exportBatch?language=` + params.language + '&type=' + params.type,
    method: 'post',
    data
  });
}

// 轮询
function exportBatchForKey(key) {
  return fetch({
    url: `${baseUrl}/minorStudentScoreManager/studentScorePrint/exportBatchForKey?key=` + key,
    method: 'get'
  });
}
export default {
    'downloadOne': downloadOne,
    'downloadTwo': downloadTwo,
    'getScoreRecordMethodList': getScoreRecordMethodList,
    'addScoreRecordMethod': addScoreRecordMethod,
    'getScoreRecordMethod': getScoreRecordMethod,
    'editScoreRecordMethod': editScoreRecordMethod,
    'deleteScoreRecordMethod': deleteScoreRecordMethod,
    'queryGlobalSetInfo': queryGlobalSetInfo,
    'addOrUpdateGlobalSetInfo': addOrUpdateGlobalSetInfo,
    'getGradeRightSwitchList': getGradeRightSwitchList,
    'queryStartCollege': queryStartCollege,
    'updateScoreEntrySwitch': updateScoreEntrySwitch,
    'deleteScoreEntrySwitch': deleteScoreEntrySwitch,
    'addOrSaveScoreEntrySwitch': addOrSaveScoreEntrySwitch,
    'getTotalEvalScoreRecordType': getTotalEvalScoreRecordType,
    'queryCourseScoreMana': queryCourseScoreMana,
    'pointDesignatedEntry': pointDesignatedEntry,
    'cancelDesignatedEntry': cancelDesignatedEntry,
    'queryCourseScoreManaWhiteInfo': queryCourseScoreManaWhiteInfo,
    'addCourseScoreManaWhiteInfo': addCourseScoreManaWhiteInfo,
    'deleteCourseScoreManaWhiteInfo': deleteCourseScoreManaWhiteInfo,
    'queryCourseInfoByCourseCode': queryCourseInfoByCourseCode,
    'queryFinalAssessResults': queryFinalAssessResults,
    'sendMessage': sendMessage,
    'validateMessage': validateMessage,
    'queryBlankScoreSheet': queryBlankScoreSheet,
    'selectGradeListFinalTotal': selectGradeListFinalTotal,
    'selectGradeStatistics': selectGradeStatistics,
    'queryScoreStucture': queryScoreStucture,
    'queryScoreEntryTime': queryScoreEntryTime,
    'saveScoreStructureInfo': saveScoreStructureInfo,
    'queryRetakeGradeManage': queryRetakeGradeManage,
    'getFinalScoreEntryInitPage': getFinalScoreEntryInitPage,
    'saveAndSubmitGradeEntry': saveAndSubmitGradeEntry,
    'validateGradeEntry': validateGradeEntry,
    'downloadGradeEntryTemplate': downloadGradeEntryTemplate,
    'queryWhiteCourseInfoByCode': queryWhiteCourseInfoByCode,
    'getMinorGradeInfos': getMinorGradeInfos,
    'getMinorGradeCountDistribute': getMinorGradeCountDistribute,
    'getStudentGradeMaintain': getStudentGradeMaintain,
    'queryStudentInfoByCode': queryStudentInfoByCode,
    'queryCourseScoreInfoById': queryCourseScoreInfoById,
    'updateStudentGradeMaintain': updateStudentGradeMaintain,
    'deleteStudentGradeMaintain': deleteStudentGradeMaintain,
    'downloadStudentGradeMaintain': downloadStudentGradeMaintain,
    'getGradeChangeList': getGradeChangeList,
    'applyOrEditScoreChangeApply': applyOrEditScoreChangeApply,
    'queryScoreChangeStudentInfo': queryScoreChangeStudentInfo,
    'queryScoreChangeGradeInfo': queryScoreChangeGradeInfo,
    'selectScoreChangeApplyInfo': selectScoreChangeApplyInfo,
    'getScoreChangeAuditList': getScoreChangeAuditList,
    'getScoreChangePointAudit': getScoreChangePointAudit,
    'pointAuditPerson': pointAuditPerson,
    'auditGradeChange': auditGradeChange,
    'exportProjectManageList': exportProjectManageList,
    'getScroeOperationLog': getScroeOperationLog,
    'getMinorScoreOptionTypeList': getMinorScoreOptionTypeList,
    'exportMinorScoreOperationLog': exportMinorScoreOperationLog,
    'getListPage': getListPage,
    'getScoreListPage': getScoreListPage,
    'getScorePreview': getScorePreview,
    'exportMinorStudentScorePrint': exportMinorStudentScorePrint,
    'queryCourseScoreChangeApply': queryCourseScoreChangeApply,
    'getApproveDetail': getApproveDetail,
    'applyOrEditScoreChangeSubmit': applyOrEditScoreChangeSubmit,
    'queryApproveList': queryApproveList,
    'updateReviewer': updateReviewer,
    'confirmationAudit': confirmationAudit,
    'clearScoreEntries': clearScoreEntries,
    'minorScoreChangeTip': minorScoreChangeTip,
    'queryStudentBasicInfo': queryStudentBasicInfo,
    'cancelMinorPublish': cancelMinorPublish,
    'checkHasGradeChange': checkHasGradeChange,
    'exportBatch': exportBatch,
    'exportBatchForKey': exportBatchForKey
};

